package com.djx.provider.controller;

import com.djx.comm.entity.User;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("demo")
public class demoController {

    @GetMapping("hello")
    public String hello() {
        return "hello world";
    }

    public static void main(String[] args) {
        User user1 = User.builder()
                .account("admin")
                .password("admin")
                .build();
        User user2 = User.builder()
                .name("zhangsan")
                .phone("12345678")
                .account("test")
                .password("test")
                .build();
//        System.out.println(user1.toString());
//        System.out.println(user2.toString());
//        BeanUtils.copyProperties(user2, user1);
//        System.out.println(user1.toString());
//        System.out.println(user2.toString());
        List<User> list = new ArrayList<>();
        list.add(user1);
        list.add(user2);
        System.out.println(StringUtils.join(list.stream().map(x -> x.getAccount()).collect(Collectors.toList()).toArray(),","));
        System.out.println(com.djx.comm.util.StringUtils.frontCompWithZero(123,8));
        System.out.println(4<<4);
    }
}
